-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle short position case for displaying liquidation price, live-update position row items #205
Conversation
let currentLeverage = input.summary?.positionLeverage?.doubleValue ?? 0 | ||
let postLeverage = input.summary?.positionLeverageUpdated?.doubleValue ?? 0 | ||
|
||
viewModel?.liquidationPrice = dydxAdjustMarginLiquidationPriceViewModel() | ||
|
||
if input.summary?.positionLeverageUpdated == nil { | ||
let hasNoInput = input.summary?.positionLeverageUpdated == nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've seen positionLeverageUpdated sometimes be a weird value. on android i'm just checking input.amount == nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if input.amount
is "0" though or "000" etc, i wanted to avoid that
viewModel?.liquidationPrice?.direction = .none | ||
if currentLeverage <= 1 { | ||
if currentLeverage <= 1 && side == Abacus.PositionSide.long_ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up to you on whether you want to simplify this if else - on Android i didn't end up doing any complex checks on leverage or side. i just used hasNoInput
and liquidation price directly. if it is nil, it's because there is no liquidation price (leverage <= 1 and long).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did u decide to display "None" or not then?
…ate position row items (#205) * handle short position case for displaying liquidation price * remove viewmodel caching
…ate position row items (#205) * handle short position case for displaying liquidation price * remove viewmodel caching
…ate position row items (#205) * handle short position case for displaying liquidation price * remove viewmodel caching
Links (dYdX Internal Use Only)
Linear Ticket:
Figma Design: https://www.figma.com/design/mKevZOfE9nj6MZpiolKYW1/dYdX-%E2%80%BA-Mobile?node-id=5956-16570&t=H5PO3Em25YfPWYom-4
Description / Intuition
Before/After Screenshots or Videos
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-07-01.at.12.27.31.mp4
Type of Change